<?php
namespace Swoole\Handler;
use \Swoole\Service\ThriftServiceIf;
use Common\FileUtil;
class ThriftServiceHandler implements ThriftServiceIf{

//     function __construct(){
//     }
    
    public function getServers()
    {
//         $servers = \Swoole\Registry\RegistryClient::readFile();
        $servers = FileUtil::readThriftServer();
        $servers = json_decode($servers, true);
        $servers2 = \Swoole\Thrift\SwooleHttpServer::$thriftServer;
        $existServers = array();
        if(count($servers) > 0){
            foreach($servers as $key => $s){
                $server = new \Swoole\Service\ThriftServer();
                $server->host = $s['host'];
                $server->port = $s['port'];
                $existServers[] = $server;
            }
        }
        return $existServers;
    }
}

?>